<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let obj = {
            name:'老王',
            age:18,
        }

        // console.log(obj.toString());

        // obj.name = '小李';
        // console.log(obj);

        let str = JSON.stringify(obj);

        // console.log(typeof str);
        // str.name = '王老吉';

        // 属性名 带双引，属性值 ：字符串 带双引。

        console.log(str);

        // json是什么类型

        let str2 = `
            {
                "name":"小李",
                "age":18,
                "like":[
                    "篮球",
                    "足球"
                ]
            }
        `;

        // console.log(typeof str);
        console.log(JSON.parse(str2));

        let obj2 = JSON.parse(str2);
        obj2.name ='康师傅'
        console.log(obj2);
    </script>
</body>
</html>